package com.supostacks.domain.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.supostacks.domain.repository.ICardKeyRepository;
import com.supostacks.domain.service.ICardKeyService;
import com.supostacks.domain.vo.CardKeyVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class CardKeyServiceImpl implements ICardKeyService {
    @Resource
    private ICardKeyRepository cardKeyRepository;

    @Override
    public String insert(CardKeyVo cardKeyVo) {
        return cardKeyRepository.insert(cardKeyVo);
    }

    @Override
    public void deleteById(String id) {
        cardKeyRepository.deleteById(id);
    }

    @Override
    public String updateById(CardKeyVo categoryInfoVo) {
        return cardKeyRepository.updateById(categoryInfoVo);
    }

    @Override
    public CardKeyVo selectById(String id) {
        return cardKeyRepository.selectById(id);
    }

    @Override
    public List<CardKeyVo> selectList(JSONObject param) {
        List<CardKeyVo> cardKeyVos = cardKeyRepository.selectList(param);
        return new ArrayList<>(cardKeyVos);
    }

    @Override
    public JSONObject selectByPage(JSONObject param,int pageNo,int pageSize) {
        return cardKeyRepository.selectByPage(param, pageNo,pageSize);
    }

    @Override
    public CardKeyVo selectCardKeyByCode(String code) {
        return cardKeyRepository.selectCardKeyByCode(code);
    }

}
